using System;
using System.Collections.Generic;
using System.Text;

namespace RunAliasCreator
{
	/// <summary>
	/// Provides convenient methods for error handling.
	/// </summary>
	public static class Errors
	{
		/// <summary>
		/// Summarizes an exception into an user-friendly error message.
		/// </summary>
		/// <param name="ex">The exception to summarize.</param>
		/// <returns>A System.String containing the error message.</returns>
		public static string SummarizeException(Exception ex)
		{
			if (ex == null) return string.Empty;
			string buffer = Functions.CodeNameToPrettyName(ex.GetType().Name);
			if (ex.Message != null && ex.Message != string.Empty)
				buffer += ": " + ex.Message;
			return buffer;
		}
	}
}
